<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>同步回调 与 异步回调</title>
</head>
<body>
  <script>
    //同步回调
    //数组方法的参数
    // let arr = [1,2,3];

    // arr.forEach(item => {
    //   console.log(item);
    // });

    // console.log('ok');

    //异步回调
    // setTimeout(() => {
    //   console.log(123);
    // }, 1000);

    // console.log(456)

    //测试
    function fn(cb){
      // setTimeout(() => {
        cb();
      // }, 10)
    }

    fn(() => {
      console.log(123);
    })

    console.log(456)
  </script>
</body>
</html>